export default class {

    public username: String;

    public password: String;

    public rememberLogin: Boolean;

    public returnUrl: string;

    constructor() {
        this.username = 'alice@qq.com';
        this.password = 'admin@123';
        this.rememberLogin = true;
        this.returnUrl = decodeURIComponent(this.parseReturnUrl());
    }

    /**
     * 从url中获取returnUrl数据
     */
    private parseReturnUrl() {
        var search = location.search;
        search = search ? search.substring(1, search.length) : '/';
        var params = search.split('=');

        for (var index = 0; index < params.length; index++) {
            if (params[index].toLowerCase() == 'returnurl') {
                return params[index + 1] || '/';
            }
        }

        return '/';
    }

}